package com.byteblogs.helloblog.integration;

import com.byteblogs.helloblog.constants.Constant;
import com.byteblogs.helloblog.dto.HttpResult;
import com.byteblogs.helloblog.integration.dto.EmailDTO;
import com.byteblogs.helloblog.integration.dto.PostsDTO;
import com.byteblogs.helloblog.integration.dto.UserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author byteblogs
 */
@FeignClient(name = "byteBlogsClient", url = Constant.BASE_BYTE_BLOGS_URL)
public interface ByteBlogsClient {

    @GetMapping("/posts/posts/list")
    HttpResult getPostsList(@RequestParam(value = "pagingQuery.pageIndex", required = false) Integer pageIndex,
                            @RequestParam(value = "pagingQuery.pageSize", required = false) Integer pageSize);

    @GetMapping("/aggregation/user/v1/count")
    HttpResult countPerson();

    @GetMapping("/aggregation/user/v1/chart")
    HttpResult getViewsChart();

    @GetMapping("/oauth/github-authorize/v1/get")
    HttpResult githubAuthorize(@RequestParam(value = "state", required = false) String state);

    @PostMapping("/email/hello-blog/v1/send")
    HttpResult sendRegisterEmail(@RequestBody EmailDTO emailDTO);

    @PostMapping("/authentication/hello-blog/v1/register")
    HttpResult registerUsers(@RequestBody UserDTO userDTO);

    @PostMapping("/posts/hello-blog/v1/add")
    HttpResult syncPosts(@RequestBody PostsDTO postsDTO);
}
